package com.da.javatest.leetCode;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2019/1/14 16:27
 * @description
 */
public class Code976 {
    public int largestPerimeter(int[] A) {
        int total = 0;
        Arrays.sort(A);
        for (int i = 0; i < A.length - 2; i++) {
            if (A[i] + A[i + 1] > A[i + 2]) {
                total = Math.max(total, A[i] + A[i + 1] + A[i + 2]);
            }
        }
        return total;
    }
}
